package com.wolf.client;

import com.wolf.coder.WolfDecoder;
import com.wolf.coder.WolfEncoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;

/**
 * @auth: dylan
 * @Desc:
 * @Time: 2024/5/1
 */
public class WolfClientInitialHandler extends ChannelInitializer<NioSocketChannel> {
    @Override
    protected void initChannel(NioSocketChannel channel) throws Exception {
        channel.pipeline()
                .addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE,5,4,0,0))
                .addLast(new WolfDecoder())
                .addLast(new WolfEncoder())
                .addLast(new ClientInboundHandler());
    }
}
